package sctu.edu.java.year2016.team08.lisonghong.day20160522.chapter6_2;

/**
 * 编写程序，用for,if语句去除空格
 * Created by 松红 on 2016/5/22.
 */
public class chapter6_2 {
    public static void main(String[] args) {
        String s = new String("li song hong");
        int b = s.indexOf(" ");
        if (b != 0) {
            String[] a = s.split(" ");
            for (int i = 0; i < a.length; i++)
                System.out.print(a[i]);
        } else
            System.out.println();

    }
}
